<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>JSON Voorhees: jsonv/parse.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script><script type="text/javascript" async src="http://www.mathjax.org/mathjax/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">JSON Voorhees
   </div>
   <div id="projectbrief">Killer JSON for C++</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('parse_8hpp_source.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">parse.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="parse_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/** \file jsonv/parse.hpp</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> *  </span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> *  Copyright (c) 2012-2014 by Travis Gockel. All rights reserved.</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *  This program is free software: you can redistribute it and/or modify it under the terms of the Apache License</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> *  as published by the Apache Software Foundation, either version 2 of the License, or (at your option) any later</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> *  version.</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> *  \author Travis Gockel (travis@gockelhut.com)</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment">**/</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#ifndef __JSONV_PARSE_HPP_INCLUDED__</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#define __JSONV_PARSE_HPP_INCLUDED__</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;</div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="config_8hpp.html">jsonv/config.hpp</a>&gt;</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="string__view_8hpp.html">jsonv/string_view.hpp</a>&gt;</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="value_8hpp.html">jsonv/value.hpp</a>&gt;</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;</div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#include &lt;cstddef&gt;</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#include &lt;deque&gt;</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor">#include &lt;stdexcept&gt;</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacejsonv.html">jsonv</a></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;{</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="keyword">class </span>tokenizer;</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="comment">/** An error encountered when parsing.</span></div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="comment"> *  </span></div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="comment"> *  \see parse</span></div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="comment">**/</span></div><div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="classjsonv_1_1parse__error.html">   31</a></span>&#160;<span class="keyword">class </span><a class="code" href="config_8hpp.html#acd0703012bd724b356c177b7bc3d761d">JSONV_PUBLIC</a> <a class="code" href="classjsonv_1_1parse__error.html">parse_error</a> :</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;        <span class="keyword">public</span> std::runtime_error</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;{</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;    <span class="keyword">typedef</span> std::size_t size_type;</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;    <span class="comment"></span></div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="comment">    /** Description of a single parsing problem. **/</span></div><div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="structjsonv_1_1parse__error_1_1problem.html">   38</a></span>&#160;    <span class="keyword">struct </span><a class="code" href="structjsonv_1_1parse__error_1_1problem.html">problem</a></div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;    {</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    <span class="keyword">public</span>:</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;        <a class="code" href="structjsonv_1_1parse__error_1_1problem.html">problem</a>(size_type line, size_type column, size_type character, std::string message);</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;        <span class="comment"></span></div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="comment">        /** The line of input this error was encountered on. A new &quot;line&quot; is determined by carriage return or line feed.</span></div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="comment">         *  If you are in Windows and line breaks are two characters, the line number of the error will appear to be</span></div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<span class="comment">         *  twice as high as you would think.</span></div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="comment">        **/</span></div><div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="structjsonv_1_1parse__error_1_1problem.html#af85e8a85b6f996a77d4eb52ed420305c">   47</a></span>&#160;        size_type <a class="code" href="structjsonv_1_1parse__error_1_1problem.html#af85e8a85b6f996a77d4eb52ed420305c">line</a>()<span class="keyword"> const</span></div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="keyword">        </span>{</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;            <span class="keywordflow">return</span> _line;</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;        }</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;        <span class="comment"></span></div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="comment">        /** The character index on the current line this error was encountered on. **/</span></div><div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="structjsonv_1_1parse__error_1_1problem.html#af337b9ada6a42e1728cf1c95a111ef2d">   53</a></span>&#160;        size_type <a class="code" href="structjsonv_1_1parse__error_1_1problem.html#af337b9ada6a42e1728cf1c95a111ef2d">column</a>()<span class="keyword"> const</span></div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="keyword">        </span>{</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;            <span class="keywordflow">return</span> _column;</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;        }</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;        <span class="comment"></span></div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="comment">        /** The character index into the entire input this error was encountered on. **/</span></div><div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="structjsonv_1_1parse__error_1_1problem.html#af5d56da1f2772eb1916f635afff73faa">   59</a></span>&#160;        size_type <a class="code" href="structjsonv_1_1parse__error_1_1problem.html#af5d56da1f2772eb1916f635afff73faa">character</a>()<span class="keyword"> const</span></div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;<span class="keyword">        </span>{</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;            <span class="keywordflow">return</span> _character;</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;        }</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;        <span class="comment"></span></div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;<span class="comment">        /** A message from the parser which has user-readable details about the encountered problem. **/</span></div><div class="line"><a name="l00065"></a><span class="lineno"><a class="line" href="structjsonv_1_1parse__error_1_1problem.html#af13fc3d363ffcf5b7e463bdf60fa0aa7">   65</a></span>&#160;        <span class="keyword">const</span> std::string&amp; message()<span class="keyword"> const</span></div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;<span class="keyword">        </span>{</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;            <span class="keywordflow">return</span> _message;</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;        }</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;        </div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;    <span class="keyword">private</span>:</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;        size_type   _line;</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;        size_type   _column;</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;        size_type   _character;</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;        std::string _message;</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    };</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    </div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    <span class="keyword">typedef</span> std::deque&lt;problem&gt; problem_list;</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    </div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;    <a class="code" href="classjsonv_1_1parse__error.html">parse_error</a>(problem_list, <a class="code" href="classjsonv_1_1value.html">value</a> partial_result);</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    </div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;    <span class="keyword">virtual</span> ~<a class="code" href="classjsonv_1_1parse__error.html">parse_error</a>() noexcept;</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;    <span class="comment"></span></div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;<span class="comment">    /** The list of problems which ultimately contributed to this \c parse_error. There will always be at least one</span></div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;<span class="comment">     *  \c problem in this list.</span></div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;<span class="comment">    **/</span></div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    const problem_list&amp; problems() const;</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    <span class="comment"></span></div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;<span class="comment">    /** Get the partial result of parsing. There is no guarantee this value even resembles the input JSON as the input</span></div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;<span class="comment">     *  JSON was malformed.</span></div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;<span class="comment">    **/</span></div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    const <a class="code" href="classjsonv_1_1value.html">value</a>&amp; partial_result() const;</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    </div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;private:</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;    problem_list _problems;</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;    <a class="code" href="classjsonv_1_1value.html">value</a>        _partial_result;</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;};</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;<span class="comment">/** Get a string representation of a problem. **/</span></div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;<a class="code" href="config_8hpp.html#acd0703012bd724b356c177b7bc3d761d">JSONV_PUBLIC</a> <a class="code" href="namespacestd.html">std</a>::ostream&amp; operator&lt;&lt;(<a class="code" href="namespacestd.html">std</a>::ostream&amp; os, const <a class="code" href="classjsonv_1_1parse__error.html">parse_error</a>::problem&amp; p);</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;<span class="comment">/** Get a string representation of a problem. **/</span></div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;<a class="code" href="config_8hpp.html#acd0703012bd724b356c177b7bc3d761d">JSONV_PUBLIC</a> <a class="code" href="namespacestd.html">std</a>::<span class="keywordtype">string</span> to_string(const <a class="code" href="classjsonv_1_1parse__error.html">parse_error</a>::problem&amp; p);</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;<span class="comment">/** Get a string representation of a \c parse_error. **/</span></div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;<a class="code" href="config_8hpp.html#acd0703012bd724b356c177b7bc3d761d">JSONV_PUBLIC</a> <a class="code" href="namespacestd.html">std</a>::ostream&amp; operator&lt;&lt;(<a class="code" href="namespacestd.html">std</a>::ostream&amp; os, const <a class="code" href="classjsonv_1_1parse__error.html">parse_error</a>&amp; p);</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;<span class="comment">/** Get a string representation of a \c parse_error. **/</span></div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;<a class="code" href="config_8hpp.html#acd0703012bd724b356c177b7bc3d761d">JSONV_PUBLIC</a> <a class="code" href="namespacestd.html">std</a>::<span class="keywordtype">string</span> to_string(const <a class="code" href="classjsonv_1_1parse__error.html">parse_error</a>&amp; p);</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;<span class="comment">/** Configuration for various parsing options. All parse functions should take in a \c parse_options as a paramter and</span></div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;<span class="comment"> *  should respect your settings.</span></div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;<span class="comment">**/</span></div><div class="line"><a name="l00114"></a><span class="lineno"><a class="line" href="classjsonv_1_1parse__options.html">  114</a></span>&#160;class <a class="code" href="config_8hpp.html#acd0703012bd724b356c177b7bc3d761d">JSONV_PUBLIC</a> <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a></div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;{</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    <span class="keyword">using</span> size_type = value::size_type;</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;    <span class="comment"></span></div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;<span class="comment">    /** When a parse error is encountered, what should the parser do? **/</span></div><div class="line"><a name="l00120"></a><span class="lineno"><a class="line" href="classjsonv_1_1parse__options.html#a301e7d4d58ec502dae5c1020ebc06f46">  120</a></span>&#160;    <span class="keyword">enum class</span> <a class="code" href="classjsonv_1_1parse__options.html#a301e7d4d58ec502dae5c1020ebc06f46">on_error</a></div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;    {<span class="comment"></span></div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;<span class="comment">        /** Immediately throw a \c parse_error -- do not attempt to construct a partial result. **/</span></div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;        fail_immediately,<span class="comment"></span></div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;<span class="comment">        /** Attempt to continue parsing and constructing a result. **/</span></div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;        collect_all,<span class="comment"></span></div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;<span class="comment">        /** Ignore all errors and pretend to be successful. This is not recommended unless you are 100% certain the</span></div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;<span class="comment">         *  JSON you are attempting to parse is valid. Using this failure mode does not improve parser performance.</span></div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;<span class="comment">        **/</span></div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;        <a class="code" href="group__Serialization.html#gga645b8b2ddf86926dab927adb704ea352a567bc1d268f135496de3d5b946b691f3">ignore</a>,</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;    };</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;    <span class="comment"></span></div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;<span class="comment">    /** The encoding format for strings. **/</span></div><div class="line"><a name="l00133"></a><span class="lineno"><a class="line" href="classjsonv_1_1parse__options.html#acdf4825f573d55b50c82d455fb93f593">  133</a></span>&#160;    <span class="keyword">enum class</span> <a class="code" href="classjsonv_1_1parse__options.html#acdf4825f573d55b50c82d455fb93f593">encoding</a></div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;    {<span class="comment"></span></div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;<span class="comment">        /** Use UTF-8 like a sane library should.</span></div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;<span class="comment">         *  </span></div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;<span class="comment">         *  \see http://www.unicode.org/versions/Unicode6.2.0/ch03.pdf#G7404</span></div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;<span class="comment">        **/</span></div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;        utf8,<span class="comment"></span></div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;<span class="comment">        /** Like \c utf8, but check that there are no unprintable characters in the input stream (see \c std::isprint).</span></div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;<span class="comment">         *  To contrast this with \c utf8, this mode will reject things such as the \c tab and \c newline characters,</span></div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;<span class="comment">         *  while this will reject them.</span></div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;<span class="comment">        **/</span></div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;        utf8_strict,<span class="comment"></span></div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;<span class="comment">        /** Use the CESU-8 Compatibility Encoding Scheme for UTF-16? It is generally not recommended unless your</span></div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;<span class="comment">         *  processing environment requires binary collation with UTF-16. If you do not know you need this, you probably</span></div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;<span class="comment">         *  do not.</span></div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;<span class="comment">         *  </span></div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;<span class="comment">         *  \see http://www.unicode.org/reports/tr26/</span></div><div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;<span class="comment">        **/</span></div><div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;        cesu8,</div><div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;    };</div><div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;    <span class="comment"></span></div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;<span class="comment">    /** When dealing with comma separators, how should extra commas be treated? **/</span></div><div class="line"><a name="l00155"></a><span class="lineno"><a class="line" href="classjsonv_1_1parse__options.html#a07d2a01c5527614ea710a84e8c88d714">  155</a></span>&#160;    <span class="keyword">enum class</span> <a class="code" href="classjsonv_1_1parse__options.html#a07d2a01c5527614ea710a84e8c88d714">commas</a></div><div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;    {<span class="comment"></span></div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;<span class="comment">        /** Do not allow any extra commas anywhere -- require valid JSON. **/</span></div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;        strict,<span class="comment"></span></div><div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;<span class="comment">        /** Allow a single trailing comma at the end of an array or object (similar to C++ \c enum definitions). **/</span></div><div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;        allow_trailing,</div><div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;    };</div><div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;    <span class="comment"></span></div><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;<span class="comment">    /** How should numbers be dealt with? **/</span></div><div class="line"><a name="l00164"></a><span class="lineno"><a class="line" href="classjsonv_1_1parse__options.html#a62238f46e2076c4e3ac113345476176a">  164</a></span>&#160;    <span class="keyword">enum class</span> <a class="code" href="classjsonv_1_1parse__options.html#a62238f46e2076c4e3ac113345476176a">numbers</a></div><div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;    {<span class="comment"></span></div><div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;<span class="comment">        /** Parse \e all forms of decimal input that we can. To contrast this from \c strict, the \c decimal does not</span></div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;<span class="comment">         *  allow leading zeros on numbers.</span></div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;<span class="comment">        **/</span></div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;        decimal,<span class="comment"></span></div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;<span class="comment">        /** Strictly comply with the JSON specification for numbers -- no leading zeros! **/</span></div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;        strict,</div><div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;    };</div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;    </div><div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;<span class="keyword">public</span>:<span class="comment"></span></div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;<span class="comment">    /** Create an instance with the default options. **/</span></div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;    <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a>();</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;    </div><div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;    ~<a class="code" href="classjsonv_1_1parse__options.html">parse_options</a>() noexcept;</div><div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;    <span class="comment"></span></div><div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;<span class="comment">    /** Create a parser with the default options -- this is the same result as the default constructor, but might be</span></div><div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;<span class="comment">     *  helpful if you like to be more explicit.</span></div><div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;<span class="comment">    **/</span></div><div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;    static <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a> create_default();</div><div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;    <span class="comment"></span></div><div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;<span class="comment">    /** Create a strict parser. In general, these options are meant to fail on anything that is not a 100% valid JSON</span></div><div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;<span class="comment">     *  document. More specifically:</span></div><div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;<span class="comment">     *  </span></div><div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;<span class="comment">     *  \code</span></div><div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;<span class="comment">     *  failure_mode() == on_error::fail_immediately</span></div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;<span class="comment">     *  string_encoding() == encoding::utf8_strict</span></div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;<span class="comment">     *  number_encoding() == numbers::strict</span></div><div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;<span class="comment">     *  comma_policy() == commas::strict</span></div><div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;<span class="comment">     *  max_structure_depth() == 20</span></div><div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;<span class="comment">     *  require_document() == true</span></div><div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;<span class="comment">     *  complete_parse() == true</span></div><div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;<span class="comment">     *  comments() == false</span></div><div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;<span class="comment">     *  \endcode</span></div><div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;<span class="comment">    **/</span></div><div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;    static <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a> create_strict();</div><div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;    <span class="comment"></span></div><div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;<span class="comment">    /** See \c on_error. The default failure mode is \c fail_immediately. **/</span></div><div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;    on_error failure_mode() const;</div><div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;    <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a>&amp; failure_mode(on_error mode);</div><div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;    <span class="comment"></span></div><div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;<span class="comment">    /** The maximum allowed parsing failures the parser can encounter before throwing an error. This is only applicable</span></div><div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;<span class="comment">     *  if the \c failure_mode is not \c on_error::fail_immediately. By default, this value is 10.</span></div><div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;<span class="comment">     *  </span></div><div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;<span class="comment">     *  You should probably not set this value to an unreasonably high number, as each parse error encountered must be</span></div><div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;<span class="comment">     *  stored in memory for some period of time.</span></div><div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;<span class="comment">    **/</span></div><div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;    <a class="code" href="namespacestd.html">std</a>::<span class="keywordtype">size_t</span> max_failures() const;</div><div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;    <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a>&amp; max_failures(<a class="code" href="namespacestd.html">std</a>::<span class="keywordtype">size_t</span> limit);</div><div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;    <span class="comment"></span></div><div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;<span class="comment">    /** The output encoding for multi-byte characters in strings. The default value is UTF-8 because UTF-8 is best. Keep</span></div><div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;<span class="comment">     *  in mind this changes the output encoding for \e all decoded strings. If you need mixed encodings, you must</span></div><div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;<span class="comment">     *  handle that in your application.</span></div><div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;<span class="comment">    **/</span></div><div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;    encoding string_encoding() const;</div><div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;    <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a>&amp; string_encoding(encoding);</div><div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;    <span class="comment"></span></div><div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;<span class="comment">    /** How should a parser interpret numbers? By default, this is \c numbers::decimal, which allows any form of decimal</span></div><div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;<span class="comment">     *  input.</span></div><div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;<span class="comment">    **/</span></div><div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;    numbers number_encoding() const;</div><div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;    <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a>&amp; number_encoding(numbers);</div><div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;    <span class="comment"></span></div><div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;<span class="comment">    /** How should extra commas be treated? By default, this is \c commas::allow_trailing. **/</span></div><div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;    commas comma_policy() const;</div><div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;    <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a>&amp; comma_policy(commas);</div><div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;    <span class="comment"></span></div><div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;<span class="comment">    /** The maximum allowed nesting depth of any structure in the JSON document. The JSON specification technically</span></div><div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;<span class="comment">     *  limits the depth to 20, but very few implementations actually conform to this, so it is fairly dangerous to set</span></div><div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;<span class="comment">     *  this value. By default, the value is 0, which means we should not do any depth checking.</span></div><div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;<span class="comment">    **/</span></div><div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;    size_type max_structure_depth() const;</div><div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;    <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a>&amp; max_structure_depth(size_type depth);</div><div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;    <span class="comment"></span></div><div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;<span class="comment">    /** If set to true, the result of a parse is required to have \c kind of \c kind::object or \c kind::array. By</span></div><div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;<span class="comment">     *  default, this is turned off, which will allow \c parse to return incomplete documents.</span></div><div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;<span class="comment">    **/</span></div><div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;    <span class="keywordtype">bool</span> require_document() const;</div><div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;    <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a>&amp; require_document(<span class="keywordtype">bool</span>);</div><div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;    <span class="comment"></span></div><div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;<span class="comment">    /** Should the input be completely parsed to consider the parsing a success? This is on by default. Disabling this</span></div><div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;<span class="comment">     *  option can be useful for situations where JSON input is coming from some stream and you wish to process distinct</span></div><div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;<span class="comment">     *  objects separately (this technique is used to great effect in jq: http://stedolan.github.io/jq/).</span></div><div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;<span class="comment">     *  </span></div><div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;<span class="comment">     *  \warning</span></div><div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;<span class="comment">     *  When using this option, it is best to construct a \c tokenizer for your input stream and reuse that. The</span></div><div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;<span class="comment">     *  \c parse functions all internally buffer your \c istream and while they \e attempt to use \c putback re-put</span></div><div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;<span class="comment">     *  characters back into the \c istream, they are not necessarily successful at doing so.</span></div><div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;<span class="comment">    **/</span></div><div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;    <span class="keywordtype">bool</span> complete_parse() const;</div><div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;    <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a>&amp; complete_parse(<span class="keywordtype">bool</span>);</div><div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;    <span class="comment"></span></div><div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;<span class="comment">    /** Are JSON comments allowed?</span></div><div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;<span class="comment">     *  </span></div><div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;<span class="comment">     *  \warning</span></div><div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;<span class="comment">     *  There is no &quot;official&quot; syntax for JSON comments, but this system allows</span></div><div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;<span class="comment">    **/</span></div><div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;    <span class="keywordtype">bool</span> comments() const;</div><div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;    <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a>&amp; comments(<span class="keywordtype">bool</span>);</div><div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;    </div><div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;private:</div><div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;    <span class="comment">// For the purposes of ABI compliance, most modifications to the variables in this class should bump the minor</span></div><div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;    <span class="comment">// version number.</span></div><div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;    on_error    _failure_mode     = on_error::fail_immediately;</div><div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;    <a class="code" href="namespacestd.html">std</a>::<span class="keywordtype">size_t</span> _max_failures     = 10;</div><div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;    encoding    _string_encoding  = encoding::utf8;</div><div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;    numbers     _number_encoding  = numbers::decimal;</div><div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;    commas      _comma_policy     = commas::allow_trailing;</div><div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160;    size_type   _max_struct_depth = 0;</div><div class="line"><a name="l00273"></a><span class="lineno">  273</span>&#160;    <span class="keywordtype">bool</span>        _require_document = false;</div><div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160;    <span class="keywordtype">bool</span>        _complete_parse   = true;</div><div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;    <span class="keywordtype">bool</span>        _comments         = true;</div><div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;};</div><div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;<span class="comment">/** Reads a JSON value from the input stream.</span></div><div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160;<span class="comment"> *  </span></div><div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;<span class="comment"> *  \note</span></div><div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;<span class="comment"> *  This function is \e not intended for verifying if the input is valid JSON, as it will intentionally correctly parse</span></div><div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;<span class="comment"> *  invalid JSON (so long as it resembles valid JSON). See \c parse_options::create_strict for a strict-mode parse.</span></div><div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;<span class="comment"> *  </span></div><div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;<span class="comment"> *  \example &quot;parse(std::istream&amp;, const parse_options&amp;)&quot;</span></div><div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;<span class="comment"> *  Parse JSON from some file.</span></div><div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;<span class="comment"> *  \code</span></div><div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;<span class="comment"> *  std::ifstream file(&quot;file.json&quot;);</span></div><div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;<span class="comment"> *  jsonv::value out = parse(file);</span></div><div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;<span class="comment"> *  \endcode</span></div><div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;<span class="comment"> *  \throws parse_error if an error is found in the JSON. If the \a input terminates unexpectedly, a \c parse_error will</span></div><div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;<span class="comment"> *   still be thrown with a message like &quot;Unexpected end: unmatched {...&quot;. If you suspect the input of going bad, you</span></div><div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;<span class="comment"> *   can check the state flags or set the exception mask of the stream (exceptions thrown by \a input while processing</span></div><div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160;<span class="comment"> *   will be propagated out)</span></div><div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;<span class="comment">**/</span></div><div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;<a class="code" href="classjsonv_1_1value.html">value</a> <a class="code" href="config_8hpp.html#acd0703012bd724b356c177b7bc3d761d">JSONV_PUBLIC</a> parse(<a class="code" href="namespacestd.html">std</a>::istream&amp; input, const <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a>&amp; = <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a>());</div><div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;<span class="comment">/** Construct a JSON value from the given input.</span></div><div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;<span class="comment"> *  \throws parse_error if an error is found in the JSON.</span></div><div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;<span class="comment">**/</span></div><div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;<a class="code" href="classjsonv_1_1value.html">value</a> <a class="code" href="config_8hpp.html#acd0703012bd724b356c177b7bc3d761d">JSONV_PUBLIC</a> parse(const <a class="code" href="string__view_8hpp.html#a9cc8d30ac4b07b6f3b7e5c22fb98bcd6">string_view</a>&amp; input, const <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a>&amp; = <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a>());</div><div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;<span class="comment">/** Construct a JSON value from the given input in `[begin, end)`.</span></div><div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160;<span class="comment"> *  \throws parse_error if an error is found in the JSON.</span></div><div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;<span class="comment">**/</span></div><div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;<a class="code" href="classjsonv_1_1value.html">value</a> <a class="code" href="config_8hpp.html#acd0703012bd724b356c177b7bc3d761d">JSONV_PUBLIC</a> parse(const <span class="keywordtype">char</span>* begin, const <span class="keywordtype">char</span>* end, const <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a>&amp; = <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a>());</div><div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;<span class="comment">/** Reads a JSON value from a buffered \c tokenizer. This less convenient function is useful when setting</span></div><div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;<span class="comment"> *  \c parse_options::complete_parse to \c false.</span></div><div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;<span class="comment"> *  </span></div><div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;<span class="comment"> *  \see parse(std::istream&amp;, const parse_options&amp;)</span></div><div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;<span class="comment"> *  </span></div><div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;<span class="comment"> *  \example &quot;parse(tokenizer&amp;, const parse_options&amp;)&quot;</span></div><div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;<span class="comment"> *  \code</span></div><div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;<span class="comment"> *  tcp_stream input(get_network_stream());</span></div><div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;<span class="comment"> *  jsonv::tokenizer buffered(input);</span></div><div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;<span class="comment"> *  jsonv::parse_options options = jsonv::parse_options().complete_parse(false);</span></div><div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;<span class="comment"> *  jsonv::value x = parse(buffered, options);</span></div><div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;<span class="comment"> *  jsonv::value y = parse(buffered, options);</span></div><div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;<span class="comment"> *  \endcode</span></div><div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;<span class="comment">**/</span></div><div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;<a class="code" href="classjsonv_1_1value.html">value</a> <a class="code" href="config_8hpp.html#acd0703012bd724b356c177b7bc3d761d">JSONV_PUBLIC</a> parse(<a class="code" href="classjsonv_1_1tokenizer.html">tokenizer</a>&amp; input, const <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a>&amp; = <a class="code" href="classjsonv_1_1parse__options.html">parse_options</a>());</div><div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;</div><div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;}</div><div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;</div><div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;<span class="preprocessor">#endif</span><span class="comment">/*__JSONV_PARSE_HPP_INCLUDED__*/</span><span class="preprocessor"></span></div><div class="ttc" id="classjsonv_1_1parse__options_html"><div class="ttname"><a href="classjsonv_1_1parse__options.html">jsonv::parse_options</a></div><div class="ttdoc">Configuration for various parsing options. </div><div class="ttdef"><b>Definition:</b> <a href="parse_8hpp_source.html#l00114">parse.hpp:114</a></div></div>
<div class="ttc" id="structjsonv_1_1parse__error_1_1problem_html_af85e8a85b6f996a77d4eb52ed420305c"><div class="ttname"><a href="structjsonv_1_1parse__error_1_1problem.html#af85e8a85b6f996a77d4eb52ed420305c">jsonv::parse_error::problem::line</a></div><div class="ttdeci">size_type line() const</div><div class="ttdoc">The line of input this error was encountered on. </div><div class="ttdef"><b>Definition:</b> <a href="parse_8hpp_source.html#l00047">parse.hpp:47</a></div></div>
<div class="ttc" id="structjsonv_1_1parse__error_1_1problem_html_af337b9ada6a42e1728cf1c95a111ef2d"><div class="ttname"><a href="structjsonv_1_1parse__error_1_1problem.html#af337b9ada6a42e1728cf1c95a111ef2d">jsonv::parse_error::problem::column</a></div><div class="ttdeci">size_type column() const</div><div class="ttdoc">The character index on the current line this error was encountered on. </div><div class="ttdef"><b>Definition:</b> <a href="parse_8hpp_source.html#l00053">parse.hpp:53</a></div></div>
<div class="ttc" id="structjsonv_1_1parse__error_1_1problem_html_af5d56da1f2772eb1916f635afff73faa"><div class="ttname"><a href="structjsonv_1_1parse__error_1_1problem.html#af5d56da1f2772eb1916f635afff73faa">jsonv::parse_error::problem::character</a></div><div class="ttdeci">size_type character() const</div><div class="ttdoc">The character index into the entire input this error was encountered on. </div><div class="ttdef"><b>Definition:</b> <a href="parse_8hpp_source.html#l00059">parse.hpp:59</a></div></div>
<div class="ttc" id="classjsonv_1_1parse__error_html"><div class="ttname"><a href="classjsonv_1_1parse__error.html">jsonv::parse_error</a></div><div class="ttdoc">An error encountered when parsing. </div><div class="ttdef"><b>Definition:</b> <a href="parse_8hpp_source.html#l00031">parse.hpp:31</a></div></div>
<div class="ttc" id="namespacestd_html"><div class="ttname"><a href="namespacestd.html">std</a></div><div class="ttdoc">STL namespace. </div></div>
<div class="ttc" id="config_8hpp_html"><div class="ttname"><a href="config_8hpp.html">config.hpp</a></div><div class="ttdoc">Copyright (c) 2014-2016 by Travis Gockel. </div></div>
<div class="ttc" id="structjsonv_1_1parse__error_1_1problem_html"><div class="ttname"><a href="structjsonv_1_1parse__error_1_1problem.html">jsonv::parse_error::problem</a></div><div class="ttdoc">Description of a single parsing problem. </div><div class="ttdef"><b>Definition:</b> <a href="parse_8hpp_source.html#l00038">parse.hpp:38</a></div></div>
<div class="ttc" id="group__Serialization_html_gga645b8b2ddf86926dab927adb704ea352a567bc1d268f135496de3d5b946b691f3"><div class="ttname"><a href="group__Serialization.html#gga645b8b2ddf86926dab927adb704ea352a567bc1d268f135496de3d5b946b691f3">jsonv::duplicate_type_action::ignore</a></div><div class="ttdoc">The existing extractor or serializer should be kept, but no exception should be thrown. </div></div>
<div class="ttc" id="classjsonv_1_1parse__options_html_a07d2a01c5527614ea710a84e8c88d714"><div class="ttname"><a href="classjsonv_1_1parse__options.html#a07d2a01c5527614ea710a84e8c88d714">jsonv::parse_options::commas</a></div><div class="ttdeci">commas</div><div class="ttdoc">When dealing with comma separators, how should extra commas be treated? </div><div class="ttdef"><b>Definition:</b> <a href="parse_8hpp_source.html#l00155">parse.hpp:155</a></div></div>
<div class="ttc" id="classjsonv_1_1parse__options_html_a62238f46e2076c4e3ac113345476176a"><div class="ttname"><a href="classjsonv_1_1parse__options.html#a62238f46e2076c4e3ac113345476176a">jsonv::parse_options::numbers</a></div><div class="ttdeci">numbers</div><div class="ttdoc">How should numbers be dealt with? </div><div class="ttdef"><b>Definition:</b> <a href="parse_8hpp_source.html#l00164">parse.hpp:164</a></div></div>
<div class="ttc" id="classjsonv_1_1tokenizer_html"><div class="ttname"><a href="classjsonv_1_1tokenizer.html">jsonv::tokenizer</a></div><div class="ttdoc">Splits input into tokens, allowing traversal of JSON without verification. </div><div class="ttdef"><b>Definition:</b> <a href="tokenizer_8hpp_source.html#l00099">tokenizer.hpp:99</a></div></div>
<div class="ttc" id="classjsonv_1_1parse__options_html_acdf4825f573d55b50c82d455fb93f593"><div class="ttname"><a href="classjsonv_1_1parse__options.html#acdf4825f573d55b50c82d455fb93f593">jsonv::parse_options::encoding</a></div><div class="ttdeci">encoding</div><div class="ttdoc">The encoding format for strings. </div><div class="ttdef"><b>Definition:</b> <a href="parse_8hpp_source.html#l00133">parse.hpp:133</a></div></div>
<div class="ttc" id="string__view_8hpp_html"><div class="ttname"><a href="string__view_8hpp.html">string_view.hpp</a></div><div class="ttdoc">Pulls in an implementation of string_view. </div></div>
<div class="ttc" id="classjsonv_1_1parse__options_html_a301e7d4d58ec502dae5c1020ebc06f46"><div class="ttname"><a href="classjsonv_1_1parse__options.html#a301e7d4d58ec502dae5c1020ebc06f46">jsonv::parse_options::on_error</a></div><div class="ttdeci">on_error</div><div class="ttdoc">When a parse error is encountered, what should the parser do? </div><div class="ttdef"><b>Definition:</b> <a href="parse_8hpp_source.html#l00120">parse.hpp:120</a></div></div>
<div class="ttc" id="namespacejsonv_html"><div class="ttname"><a href="namespacejsonv.html">jsonv</a></div><div class="ttdef"><b>Definition:</b> <a href="algorithm_8hpp_source.html#l00023">algorithm.hpp:23</a></div></div>
<div class="ttc" id="config_8hpp_html_acd0703012bd724b356c177b7bc3d761d"><div class="ttname"><a href="config_8hpp.html#acd0703012bd724b356c177b7bc3d761d">JSONV_PUBLIC</a></div><div class="ttdeci">#define JSONV_PUBLIC</div><div class="ttdoc">This function or class is part of the public API for JsonVoorhees. </div><div class="ttdef"><b>Definition:</b> <a href="config_8hpp_source.html#l00104">config.hpp:104</a></div></div>
<div class="ttc" id="string__view_8hpp_html_a9cc8d30ac4b07b6f3b7e5c22fb98bcd6"><div class="ttname"><a href="string__view_8hpp.html#a9cc8d30ac4b07b6f3b7e5c22fb98bcd6">jsonv::string_view</a></div><div class="ttdeci">JSONV_STRING_VIEW_TYPE string_view</div><div class="ttdoc">A non-owning reference to a string. </div><div class="ttdef"><b>Definition:</b> <a href="string__view_8hpp_source.html#l00052">string_view.hpp:52</a></div></div>
<div class="ttc" id="classjsonv_1_1value_html"><div class="ttname"><a href="classjsonv_1_1value.html">jsonv::value</a></div><div class="ttdoc">Represents a single JSON value, which can be any one of a potential kind, each behaving slightly diff...</div><div class="ttdef"><b>Definition:</b> <a href="value_8hpp_source.html#l00131">value.hpp:131</a></div></div>
<div class="ttc" id="value_8hpp_html"><div class="ttname"><a href="value_8hpp.html">value.hpp</a></div><div class="ttdoc">Copyright (c) 2012-2018 by Travis Gockel. </div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_10cd029e0034a3f98d221f50ebb6d9d4.html">jsonv</a></li><li class="navelem"><a class="el" href="parse_8hpp.html">parse.hpp</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
  </ul>
</div>
</body>
</html>
